<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../../js/bootstrap-3.3.7-dist/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="../../../css/footer.css" />
		<link rel="stylesheet" type="text/css" href="../kaoqin.css"/>
		<link rel="stylesheet" type="text/css" href="../../../css/swiper-3.4.2.min.css" />
		<link rel="stylesheet" href="../../../css/zyUpload.css" type="text/css">
		<script src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>  
		<script src="../../../js/flexible.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
		.tan1{
			width: 100%;
			height: 100%;
			/*position: absolute;*/
			top: 0;
			left: 0;
			/*background-color: #F2F2F2;*/
			/*display: none;*/
			padding-top: 1rem;
		}
		.demo{
			margin-top: 30% auto;
		}
		#tijiao{
			display: block;
			width: 2.777777rem;
			height: 0.833333rem;
			text-align: center;
			line-height: 0.833333rem;
			background-color: #199ed8;
			border: none;
			outline: none;
			color: white;
			font-size: 0.38rem;
			margin: 0 auto;
		}
		.tan2{
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
			background-color: rgba(0,0,0,0.3);
			display: none;
		}
		.tan3{
			width: 100%;
			height: 100%;
			position: absolute;
			top: 0;
			left: 0;
			background-color: rgba(0,0,0,0.3);
			display: none;
		}
		.chenggong{
			width: 5.555555rem;
			height: 6.944444rem;
			position: absolute;
			top: 50%;
			left: 50%;
			margin-top: -3.472222rem;
			margin-left: -2.777777rem;
			background-color: #5c97f5;
			color: white;
		}
		.chenggong h3{
			text-align: center;
			padding-top: 1.111111rem;
		}
		.chenggong h4{
			margin-top: 1.111111rem;
			width: 3.055555rem;
			height: 1.111111rem;
			background-color: #eff3f6;
			color: black;
			margin: 0 auto;
			line-height: 1.111111rem;
		}
		.chenggong h4 span{
			display: block;
			float: left;
			width: 0.7rem;
			font-size: 0.38rem;
			text-align: center;
			line-height: 0.555555rem;
		}
		.chenggong h4 label{
			display: block;
			float: left;
		}
		.chenggong p{
			margin: 0;
			margin-top: 0.277777rem;
			text-align: center;
			font-size: 0.333333rem;
		}
		#know{
			display: block;
			width: 100%;
			text-align: center;
			margin-top: 1.111111rem;
			font-size: 0.333333rem;
			border: none;
			outline: none;
			border-top: 1px solid #DBDBDB;
			line-height: 1.111111rem;
			background-color: #5c97f5;
		}
	</style>
	</head>
	<body>
		<div id="wrap">
			<div id="main">
				<div id="header">
					<a id="headImg" href="javascript:history.go(-1)">
						<img class="headImg" src="../../../images/12.png" class="add_imgBox"/>
					</a>
					<p id="headTitle" style="font-size:0.38rem;">考勤打卡</p>
				</div>
			</div>
		</div>
		<div>
			<div id="chooseImage" style="border: 1px solid #333	; background:url(../../manager/images/shanghcuanred1.png) no-repeat; background-size:100% 100%; border-radius: 10px;height: 5rem;margin-top: 1.6rem;margin-left: 0.5rem;margin-right: 0.5rem;">
				<div></div>
			</div>
		</div>
		<div class="tan1">
			<div id="demo" class="demo"></div>
			<input type="button"  id="tijiao" value="确定" />
		</div>
		<input type="hidden" id="atreId" />
		<input type="hidden" id="status" />
		<input type="hidden" id="add" />
		<input type="hidden" id="lola" />
		<input type="hidden" id="pic" />
		
		
	</body>
	<script src="../../../js/jquery-2.2.3.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/jquery.cookie.js" type="text/javascript"></script>
	<script src="../../../js/bootstrap-3.3.7-dist/js/bootstrap.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/handlebars-v2.0.0.js" type="text/javascript" charset="utf-8"></script>
	<script src="../../../js/rhAdmin.js" type="text/javascript" charset="utf-8"></script>
	<!-- 引用核心层插件 -->
	<script src="../../../js/addpicture/zyFile.js"></script>
	<!-- 引用控制层插件 -->
	<!--<script src="../../../js/addpicture/zyUpload2.js"></script>-->
	<!-- 引用初始化JS -->
	<!--<script src="../../../js/addpicture/lanrenzhijia.js"></script>-->
	
	<!--接收值-->
	<script type="text/javascript">
	    function getParam(name) {
	        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
	        var r = window.location.search.substr(1).match(reg);
	        if (r != null)
	            return decodeURI(r[2]);   //对参数进行decodeURI解码
	        return null;
	    }
	
	    $(function() {
	        var atreId = getParam("atreId");
	        var status = getParam("status");
	        $('#atreId').val(atreId);
	        $('#status').val(status);
	    });
	    
		function dingwei(memberId){
			var urlf = window.location.href;
			var newUrl = "http://47.104.13.109/pay-service/getJSSDK?memberId=" + memberId + "&url="+urlf;
			//alert(newUrl);
			$.ajax({
				cache: false,
				type: "GET",
				url: newUrl,
				dataType: "JSON",
				async: false,
				success: function(data2) {
					console.log(data2.appId);
					console.log(data2.timestamp);
					console.log(data2.noncestr);
					console.log(data2.signature);
					wx.config({
					   	 debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
					    appId: data2.appId, // 必填，公众号的唯一标识
					    timestamp: data2.timestamp, // 必填，生成签名的时间戳
					    nonceStr: data2.noncestr, // 必填，生成签名的随机串
					    signature: data2.signature,// 必填，签名，见附录1
					    jsApiList: ['chooseImage',  
				       'previewImage',  
				       'uploadImage',  
				       'downloadImage'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
					});
					
					wx.ready(function () {  
					 	 wx.getLocation({ 
							success : function(res) {  
								latitude = res.latitude; // 纬度，浮点数，范围为90 ~ -90    
								longitude = res.longitude; // 经度，浮点数，范围为180 ~ -180。    
								speed = res.speed; // 速度，以米/每秒计    
								accuracy = res.accuracy; // 位置精度    
								//alert("获取到位置信息：latitude="+latitude+"accuracy="+accuracy);
								getBaiduPosition(longitude,latitude);
								//alert(accuracy);  
							}
						});
				       
				    // 5 图片接口  
				      // 5.1 拍照、本地选图  
				      var images = {  
				        localId: [],  
				        serverId: []  
				      };  
				      document.querySelector('#chooseImage').onclick = function () {  
				        wx.chooseImage({  
				          sizeType: ['compressed'], // 可以指定是原图还是压缩图，默认二者都有
    					  sourceType: ['camera'], // 可以指定来源是相册还是相机，默认二者都有
				          success: function (res) {  
				            images.localId = res.localIds;  
				            alert('已选择 ' + res.localIds.length + ' 张图片');  
				          }  
				        });  
				      };  
				  
				      // 5.2 图片预览  
				      document.querySelector('#previewImage').onclick = function () {  
				        wx.previewImage({  
				          current: 'http://img5.douban.com/view/photo/photo/public/p1353993776.jpg',  
				          urls: [  
				            'http://img3.douban.com/view/photo/photo/public/p2152117150.jpg',  
				            'http://img5.douban.com/view/photo/photo/public/p1353993776.jpg',  
				            'http://img3.douban.com/view/photo/photo/public/p2152134700.jpg'  
				          ]  
				        });  
				      };  
				  
				      // 5.3 上传图片  
				      document.querySelector('#uploadImage').onclick = function () {  
				        if (images.localId.length == 0) {  
				          alert('请先使用 chooseImage 接口选择图片');  
				          return;  
				        }  
				        var i = 0, length = images.localId.length;  
				        images.serverId = [];  
				        function upload() {  
				          wx.uploadImage({  
				            localId: images.localId[i],  
				            success: function (res) {  
				              i++;  
				              //alert('已上传：' + i + '/' + length);  
				              images.serverId.push(res.serverId);  
				              if (i < length) {  
				                upload();  
				              }  
				            },  
				            fail: function (res) {  
				              alert(JSON.stringify(res));  
				            }  
				          });  
				        }  
				        upload();  
				      };  
				  
				      // 5.4 下载图片  
				      document.querySelector('#downloadImage').onclick = function () {  
				        if (images.serverId.length === 0) {  
				          alert('请先使用 uploadImage 上传图片');  
				          return;  
				        }  
				        var i = 0, length = images.serverId.length;  
				        images.localId = [];  
				        function download() {  
				          wx.downloadImage({  
				            serverId: images.serverId[i],  
				            success: function (res) {  
				              i++;  
				              alert('已下载：' + i + '/' + length);  
				              images.localId.push(res.localId);  
				              if (i < length) {  
				                download();  
				              }  
				            }  
				          });  
				        }  
				        download();  
				      };  
				        
				  });	
						 
					wx.error(function(res){
				    });
				}
			});
		}
		
		//坐标转换
		function getBaiduPosition(lng,lat) {
			var url ="http://api.map.baidu.com/geoconv/v1/?coords="+lng+","+lat+"&from=1&to=5&ak=cEywgU0hSEVd31BAlBWPYT331WtoNNdB";
	        $.ajax({
	            url: url,
	            type: 'GET',
	            contentType: "application/json",
	            dataType: 'jsonp',//这里要用jsonp的方式不然会报错
	            success: function(data) {
	            	if(data.status == 0){
		                var dingwei = data.result[0].x+","+data.result[0].y;
						
						
						 var map = new BMap.Map("allmap");
						var point = new BMap.Point(data.result[0].x,data.result[0].y);
						var gc = new BMap.Geolocation();
						var gc2 = new BMap.Geocoder();
				        gc.getCurrentPosition(function (r) {  
				            if (this.getStatus() == BMAP_STATUS_SUCCESS) {  
				                //appLat = r.point.lat;
				                //appLng = r.point.lng;
				                
				                var pt = r.point;  
				                gc2.getLocation(pt, function (rs) {
				                	
				                    var addComp = rs.addressComponents;  
				  
				                    var dili = province +  addComp.city + addComp.district + addComp.street + addComp.streetNumber;
				  
				                });  
				            }  
				        }, { enableHighAccuracy: true });  

	            	}
	            }
	        });
	        
    	}
	   
	    $(function() {
	        $('#tijiao').click(function() {
	        	
	        });
	    });
		
	</script>
	
</html>
